package com.wsl.message;

import com.fasterxml.jackson.annotation.JsonValue;

public enum StatusCode {

    SUCCESS(200, "成功"),
    ERROR(500, "服务器错误,请求失败！"),
    LOGIN_FAIL_UN(10001,"登入失败！账号错误！"),
    LOGIN_FAIL_PWD(10002,"登入失败！密码错误！"),
    TOKEN_INVALID(20001,"token失效"),
    TOKEN_NOT(20002,"没有token"),
    TOKEN_TIME_EXPIRED(20003,"token过期"),
    TOKEN_FORMAT_ERR(20004,"token格式错误"),
    FORBIDDEN(403, "权限失败"),
    CREATE_TOKEN_ERROR(999, "Token创建失败"),
    MISSING_REQUIRE_FIELD(1000, "参数缺失"),
    PARAMETER_VALUE_RANGE_ERROR(1001, "取值范围错误"),
    HTTP_RESPONSE_ERROR(1002, "调用外部请求时，发生http请求错误"),
    JSON_ANALYSIS_ERROR(1003, "调用外部请求时，发生json数据解析错误"),
    INTERNET_IO_ERROR(1004, "调用外部请求时，发生网络IO错误"),
    SEND_MESSAGE_FAILED(1005, "发送消息失败"),
    METHOD_NOT_SUPPORT(1006, "方法调用错误，不支持此方法调用"),
    RESOURCE_UPDATE_FAILED(10001, "资源更新失败"),
    RESOURCE_INSERT_FAILED(10002, "资源添加失败"),
    RESOURCE_DELETE_FAILED(10003, "资源删除失败"),
    RESOURCE_NOT_MESSAGE_EXIT(10004, "资源信息不存在"),
    RESOURCE_IMPORT_ERROR(10005, "资源导入失败"),
    ROLE_UPDATE_FAILED(10006, "角色更新失败"),
    ROLE_INSERT_FAILED(10007, "角色添加失败"),
    ROLE_DELETE_FAILED(10008, "角色删除失败"),
    ADMIN_USER_NOT_FOUND(10100, "账户不存在"),
    ADMIN_USER_WRONG_PASSWORD(10101, "登录密码错误"),
    ROLE_LIST_NOT_EXISTS(10105, "角色列表不能为空"),
    INVALID_ACCESS_TOKEN_TYPE(200005, "token类型错误，请使用accessToken"),
    INVALID_REFRESH_TOKEN_TYPE(20006, "token类型错误，请使用refresToken"),
    MAIN_ACCOUNT_NOT_DELETE(10201, "主账号不能被删除"),
    PASSPORT_PWD_ERROR(10202, "密码错误"),
    SEND_REQUEST_ERROR(10301, "发送请求失败"),
    GET_RESPONSE_NULL(10302, "获取第三方响应结果为空"),
    NOT_OPERATE_AUTH(10401, "该用户无操作权限"),
    NOT_ADMIN_AUTH(10601, "该用户无此管理权限"),
    TAG_ADD_ERROR(420,"新增tag--标签失败，已存在重复的标签!"),
    TAG_DELL_ERROR(421,"删除tag--标签失败!,标签不存在!")
    ;

    private String message;
    private int code;

    private StatusCode(int statusCode, String statusMessage) {
        this.message = statusMessage;
        this.code = statusCode;
    }

    StatusCode() {
    }



    @JsonValue
    public String getMessage() {
        return this.message;
    }

    public int getCode() {
        return this.code;
    }
}
